home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / C++ / Applications / PICSee Dust 1.01 / Quaternary Source / SmartDragWindow.h < prev    next >
Text File  |  1995-11-22  |  2KB  |  70 lines

  1. #ifndef SMARTDRAGWINDOW_H_
  2. #define SMARTDRAGWINDOW_H_
  3.  
  4.  
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8.  
  9. /*
  10.     SmartDragWindow().
  11.     
  12.     The default action for SmartDragWindow() is to stick to the monitor
  13.     edges only. For other actions, use SuperSmartDragWindow() instead.
  14.  
  15.     Keeping down the control key during the start of the drag disables the
  16.     snap action and makes SmartDragWindow act exactly like DragWindow.
  17.  
  18.     The arguments to SmartDragWindow() are almost the same as DragWindow()...
  19.     
  20.     However, for <limitRect> you can (and most of the times should) pass an
  21.     argument of NULL or nil. Almost all of the time the argument to the
  22.     <limitRect> parameter for DragWindow is either screenBits.bounds or
  23.     (**GetGrayRgn()).rgnBBox.
  24.     So, to make your life easier just pass NULL for <limitRect> and
  25.     SmartDragWindow() will determine the limit rect *for you*.
  26.     I have kept the <limitRect> argument for those of you who wish
  27.     to use non-standard limit rects.
  28.     
  29.     If not NULL, <limitRect> should be in global coordinates.
  30. */
  31.  
  32. void SmartDragWindow(
  33.     WindowRef windowToDrag,
  34.     Point startPoint,
  35.     const Rect *limitRect,
  36.     short snapToDistance);
  37.  
  38. Boolean IsCmdKeyDown();
  39. Boolean IsControlKeyDown();
  40.  
  41. // ---------------------------------------------------------------------------
  42.  
  43. typedef void (*SnapCallback)(WindowPtr windowToDrag, short snapToDistance, Rect *snapRect);
  44.  
  45. /*
  46.     If you pass NULL to <snapProc>, SuperSmartDragWindow() acts
  47.     just like DragWindow().
  48. */
  49. void SuperSmartDragWindow(
  50.     WindowRef windowToDrag,
  51.     Point startPoint,
  52.     const Rect *limitRect,
  53.     short snapToDistance,
  54.     SnapCallback snapProc);
  55.  
  56. /*
  57.     3 predefined snap procs. If you want to use all of them, just declare
  58.     your own snap proc which in turn calls all three below.
  59. */
  60. void MonitorSnapProc(WindowPtr windowToDrag, short snapToDistance, Rect *snapRect);
  61. void WindowSnapProc(WindowPtr windowToDrag, short snapToDistance, Rect *snapRect);
  62. void GridSnapProc(WindowPtr windowToDrag, short gridSize, Rect *snapRect);
  63.  
  64.  
  65. #ifdef __cplusplus
  66. }
  67. #endif
  68.  
  69.  
  70. #endif // SMARTDRAGWINDOW_H_